<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>注册</title>
    <link rel="stylesheet" href="__INDEX__/css/style.css" />
    <link rel="stylesheet" href="__INDEX__/css/font.css" />
</head>
<style>
	.button {
		background: #3cb672 !important;
		border: 0px;
		margin-bottom: 20px;
		margin-top: 10%;
	}
    .layui-m-layercont{color:#fff;font-size: 1.1em}

</style>
<body style="background: url(__INDEX__/img/login.jpg);width: 100vw;height: 100vh;background-size: 100% 100%;">
	<div class="login rst">
		<h2>注 册</h2>
		<form  method="post">
			<div class="locgin_i">
				<i class="iconfont icon-wo"></i>
				<input type="text" name="account" placeholder="设置账号" /><span></span>
			</div>
			<div class="locgin_i">
				<i class="iconfont icon-mima1"></i>
				<input type="password" name="pwd" placeholder="设置密码" /><span></span>
			</div>
			<div class="locgin_i">
				<i class="iconfont icon-mima1"></i>
				<input type="password" name="cash_paw" placeholder="设置资金密码" /><span></span>
			</div>
			<div class="locgin_i">
				<div>
					<ul class="ulist">
						
						<li class="group">
							<label class="label" for="phone"></label>
							<div class="controls">
							<i class="iconfont icon-shoujihaoma"></i>
							<input type="number" name="phone" placeholder="手机号码" id="phone" class="txt"><span></span>
							</div>
						</li>
                        <!--<li class="group">-->
                            <!--<div class="controls">-->
                                <!--<i class="iconfont icon-yanzhengma1"></i>-->
                                <!--<input type="text" name="verify_code" placeholder="验证码" id="code" class="txt"><span></span>-->
                                <!--<a class="btn btn-small get-code" style="width: 32%;height:44px;display: block;position: absolute;margin-top:-44px;right:10%;line-height: 44px;" value="获取验证码" id="J_getCode" />获取验证码</a>-->
                                <!--&lt;!&ndash; <a class="btn btn-small reset-code" id="J_resetCode" style="display:none;width:30%;height:44px;position: absolute;margin-top:-44px;right:10%;line-height: 44px;font-size: 12px;"><span id="J_second" style="color: #fff;font-size:12px;">60</span>秒后重发</a> &ndash;&gt;-->
                            <!--</div>-->
                        <!--</li>-->
					</ul>
				</div>
			</div>
			<div class="locgin_i">
				<i class="iconfont icon-shirenrenzheng"></i>
				<input type="text" name="realname" placeholder="真实姓名" /><span></span>
			</div>
			<div class="locgin_i">
				<i class="iconfont icon-wxbzhanghu"></i>
				<input type="text" name="id_code" placeholder="身份证号码" /><span></span>
			</div>
            <div class="locgin_i">
                <i class="iconfont icon-wo"></i>
                <input type="text" name="tuijian" placeholder="输入推荐账号，不输入则为自己" /><span></span>
            </div>
            <input type="hidden" id="pid" value="{$Arr.pid}">
            <input type="hidden" id="pwz" value="{$Arr.pwz}">
			<div class="locgin_i">
				<input type="button" value="注册" id="submitReg" style="background: #008FE0 !important;border: 0px;margin-bottom: 20px;margin-top: 10%;padding: 13px 40px;width: 100%" />
			</div>

		</form>
	</div>
    <script type="text/javascript" src="__INDEX__/js/jquery.js" ></script>
    <script src="__INDEX__/js/layer/mobile/layer_mobile.js"></script>
    <script src="__INDEX__/js/layer/mobile/layer.js"></script>
    <script src="__INDEX__/js/common.js"></script>
	<script>
        $("#submitReg").click(function(){

            var account = $("input[name='account']").val();
            var pwd = $("input[name='pwd']").val();
            var phone = $("input[name='phone']").val();
//            var verify_code = $("input[name='verify_code']").val();
            var realname = $("input[name='realname']").val();
            var id_code = $("input[name='id_code']").val();
            var cash_paw = $("input[name='cash_paw']").val();
            var tuijian = $("input[name='tuijian']").val();
            var pid = $("#pid").val();
            var pwz = $("#pwz").val();
            var zwz = $("#zwz").val();
            if(account.match(/^[a-zA-Z0-9_]{5,11}$/)==null){
                prompt_From_one("请输入账号");
                return false;
            }

            if(pwd.match(/^[a-zA-Z0-9]{6,10}$/)==null){
                prompt_From_one("请输入密码");
                return false;
            }

            if(phone.match(/^1[34578]\d{9}$/) == null){
                prompt_From_one("请输入正确手机号码格式");
                return false;
            }

//            if(verify_code.match(/^\d{6}$/) == null){
//                prompt_From_one("请输入验证码");
//                return false;
//            }

            if(realname.match(/^[\u4e00-\u9fa5]+(·[\u4e00-\u9fa5]+)*$/)==null){
                prompt_From_one("请填写真实姓名");
                return false;
            }

            var id_code_reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
            if( !id_code_reg.test(id_code) ){
                prompt_From_one("请填写正确身份证号");
                return false;
            }

            if( cash_paw == "" ){
                prompt_From_one("请输入资金密码");
                return false;
            }
            $.ajax({
                type: 'POST',
                url: '{:url("Register/register")}',
                dataType: 'json',
                data: {account: account,pwd: pwd,phone: phone,
                    realname: realname,
                    id_code: id_code,cash_paw : cash_paw,pid:pid,
                    pwz:pwz,tuijian:tuijian
                },
                success: function (data) {

                    if( data.result == 0 ){
                        layer.open({
                            content: data.msg
                            ,style: 'color:#ffffff;border:none;'
                            ,time: 2 //2秒后自动关闭
                            ,end:function(){
                                location.href = '{:url("Index/index")}';
                            }
                        });
                    }else{
                        prompt_From_one(data.msg);
                    }
                }
            });
        });


	</script>

	<script>

		$("#J_getCode").click(function(){
	    var timer=null,num=60;
	    var phone= $('#phone').val();
	    if ("" == phone || !phone) {
            prompt_From_one("请输入手机号!");
	        return false;
	    } else {
	        var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
	        //验证规则
	        if (!reg.test(phone)) {
                prompt_From_one("手机号格式错误!");
	            return false;
	        }
	    }
	    $.ajax({
	        type: 'POST',
	        url: '{:url("Register/reg_code")}',
	        dataType: 'json',
	        data: {phone: phone},
	        success: function (data) {
	            if( data.result == 0 ){
                    prompt_From_one(data.msg);
	            }else{
                    prompt_From_one(data.msg);
	            }
	        }
    	});

	    timer = setInterval(function(){

		    $(".get-code").attr("disabled",true);
		    $(".get-code").text(num+"s"+"重新发送");
		    if(num < 0){
		        $(".get-code").text("获取验证码 ");
		        $(".get-code").removeAttr("disabled");
		        clearInterval(timer);
		    }
		    num--;
		},1000);

	})
	</script>
</body>
</html>